 export default{
   set(i=1){
        uni.setStorage({
          key:"succeed",
          data:i,
        });
      },
   async timeDay(){
      let nowDate = new Date()
       let nowTime = new Date(nowDate).getTime();
       let lingTime = new Date(nowDate.getFullYear(),new Date().getMonth(),nowDate.getDay(),0 ,0,0).getTime();
       let lingTimet = new Date(nowDate.getFullYear(),new Date().getMonth(),nowDate.getDay()+1,0 ,0,0).getTime();
       let time=0;
       let f=true;
       await uni.getStorage({
         key:"date"
       }).then((res)=>{
         time=res[1].data;
       }).catch((err)=>{
         time=nowTime;
         console.log(err);
         console.log("第一次没设置缓存时间");
         let nowTime= new Date().getTime();
         uni.setStorageSync("date",nowTime);
         f=false;
       });
       console.log(f)
       if(!f){
         return false;
       }
       f=true;
       console.log(time);
       console.log(nowTime);
       console.log(lingTime);
        if(time>=lingTime) {
          return true;
        }
        else{
          console.log('jinru')
          return false;
        }
       
    },
    setkey(name,password){
      uni.setStorageSync("name",name);
      uni.setStorageSync("password",password);
    },
    getkey(){

      let arr=[];
      arr.push(uni.getStorageSync("name"),uni.getStorageSync("password"));
      return arr;
    },
    setTime(){
      let nowTime= new Date().getTime();
      uni.setStorageSync("date",nowTime);
      
    },
    settodo(id){
      uni.request({
        url:'/api/user/todo',
        method:'POST',
        data:{
          userid:id,
          importH:'',
          importM:'',
          noimport:'',
          importL:'',
        },
        header:{'content-type': 'application/json'}
      })
    }
 }
 